<!--
 * @Author: tang
 * @Date: 2025-05-12 16:51:07
 * @LastEditTime: 2025-06-03 11:50:44
 * @LastEditors: kiwi
 * @FilePath: \kouhan-h5\src\views\page\index\components\banner.vue
 * @Description: banner轮播
-->
<template>
  <div class="banner-container">
    <div class="swiper-container" id="bannerSwiper">
      <div class="swiper-wrapper">
        <div class="swiper-slide" v-for="(item, idx) in banners" :key="idx">
          <div class="slide-bg" :style="{ backgroundImage: 'url(' + item.imgUrl + ')' }"></div>
          <img v-if="item.secondaryImage" class="secondary-image" :src="item.secondaryImage" alt="">
          <!-- 中间大标题 -->
          <div class="banner-title" :style="item.locationTitle">
            <span class="new">NEW</span>
            <span class="arrival">ARRIVAL</span>
          </div>
          <!-- 底部产品介绍 -->
          <div class="banner-descs" :style="item.locationDesc" v-if="item.secondaryImage">
            <div class="desc-title">
              <div>ZIP IT</div>
              <div class="highlight">POWER BURST <br> SERIES</div>
            </div>
            <div class="desc-content" :style="item.locationDescContent ? item.locationDescContent : ''">
              Experience the ultimate strength with our Bold Impact Series – designed for those who crave intense and long-lasting rush. Packed with robust flavors and a powerful nicotine hit, this series delivers an unparalleled sensation that keeps you energized and refreshed.
            </div>
          </div>
          <div class="banner-desc" :style="item.locationDesc" v-else>
            <div class="desc-title">
              <div>ZIP IT</div>
              <div class="highlight">POWER BURST SERIES</div>
            </div>
          </div>
          
          <div class="specify-img" v-if="item.secondaryImage">
            <img src="~@/assets/images/page/banner-logo2.png" alt="">
          </div>
        </div>
      </div>
      <!-- 轮播指示器 -->
      <div class="banner-pagination">
      </div>
    </div>
  </div>
</template>

<script>
import Swiper from 'swiper'
import 'swiper/css/swiper.min.css'

export default {
  name: 'Banner',
  data() {
    return {
      banners: [
        { 
          imgUrl: require('@/assets/images/page/banner1.png'),
          locationTitle: 'display: none;',
          locationDesc: 'left: 23px; bottom: 87px;',
          locationDescContent: 'color: #323232;',
          secondaryImage: require('@/assets/images/page/banner1-secondary.png')
        },
        { 
          imgUrl: require('@/assets/images/page/banner2.png'),
          locationTitle: 'left: 29px; top: 177px;',
          locationDesc: 'right: 13px; bottom: 30%;'
        },
        { 
          imgUrl: require('@/assets/images/page/banner3.png'),
          locationTitle: 'top: 177px; left: 29px;',
          locationDesc: 'right: 10%; top: 185px;'
        },
        { 
          imgUrl: require('@/assets/images/page/banner4.png'),
          locationTitle: 'top: 177px; left: 29px;',
          locationDesc: 'left: 29px; bottom: 20%;'
        },
        { 
          imgUrl: require('@/assets/images/page/banner5.png'),
          locationTitle: 'top: 177px; left: 29px;',
          locationDesc: 'right: 13px; bottom: 42px;'
        },
      ],
      bannerSwiper: null
    }
  },
  mounted() {
    this.initSwiper()
  },
  methods: {
    initSwiper() {
      this.bannerSwiper = new Swiper('#bannerSwiper', {
        loop: true,
        autoplay: {
          delay: 5000,
          disableOnInteraction: false
        },
        pagination: {
          el: '.banner-pagination',
          clickable: true
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.banner-container {
  width: 100%;
  height: 647px;
  position: relative;
  .swiper-container, .swiper-wrapper, .swiper-slide {
    width: 100%;
    height: 100%;
  }
  .swiper-slide {
    position: relative;
    .slide-bg {
      width: 100%;
      height: 100%;
      background-size: cover;
      background-position: center;
      // position: absolute;
      // top: 0; left: 0;
      // z-index: 1;
      
    }
    .secondary-image {
      width: 222px;
      height: 551px;
      position: absolute;
      right: 0;
      bottom: 18px;
    }
    .banner-title {
      position: absolute;
      top: 40%;
      left: 10%;
      font-size: 50px;
      gap: 32px;
      z-index: 2;
      color: #ffe066;
      span{
        display: inline-block;
        width: 100%;
      }
      .new {
        font-weight: bold;
      }
    }
    .banner-descs{
      position: absolute;
      padding: 0 10px;
      z-index: 2;
      .desc-title {
        margin-bottom: 16px;
        font-size: 50px;
        color: #FFE46F;
        font-weight: bold;
        font-style: italic;
        .highlight {
          font-weight: bold;
          font-size: 30px;
        }
      }
      .desc-content {
        width: 50%;
        font-size: 10px;
        line-height: 1.6;
        color: #ffffff;
        
      }
    }
    .banner-desc {
      position: absolute;
      padding: 0 10px;
      box-sizing: border-box;
      border-radius: 12px;
      z-index: 2;
      height: 40px;
      .desc-title {
        margin-bottom: 8px;
        font-size: 16px;
        color: #ffffff;
        
        .highlight {
          font-weight: bold;
          margin-top: 5px;
        }
        &::after {
          content: '';
          display: block;
          width: 1px;
          height: 100%;
          background: #FFE46F;
          position: absolute;
          left: 0;
          top: 0;
        }
      }
      .desc-content {
        font-size: 12px;
        line-height: 1.6;
        color: #ffffff;
        
      }
    }

    .specify-img {
      width: 55px;
      height: 55px;
      background-image: url('~@/assets/images/page/banner-logo.png');
      background-size: cover;
      background-position: center;
      border-radius: 50%;
      position: absolute;
      left: 30%;
      bottom: 58%;
      display: flex;
      justify-content: center;
      align-items: center;
      img{
        width: 100%;
        height: 100%;
      }
    }
  }
  ::v-deep.banner-pagination {
    position: absolute;
    left: 28px;
    bottom: 45px;
    z-index: 3;
    width: 300px;
    .swiper-pagination-bullet {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      background: #EDEDED !important;
      opacity: 0.5;
      margin-right: 8px;
    }
    .swiper-pagination-bullet-active {
      opacity: 1;
      width: 50px;
      border-radius: 5px;
      // background: #ffe066 !important;
    }
  }
}
</style>
